#ifndef BMD_HEADER
#define BMD_HEADER

// this header needs
#include <stdio.h>
#include "../../J3DGRAPH.h"

// BMD constants
umax J3DGRAPH_MIN_BMD_SIZE = 32; // need to understand better the BMD file format

// header
char * J3DGRAPH_BMD_START[2] = {"J3D2", "2D3J"};
char * J3DGRAPH_BMD_ID[2] = {"bmd3", "3dmb"};
#define J3DGRAPH_BMD_SEC_CNT 8

// for Super Mario Galaxy
byte J3DGRAPH_BMD_UNK_1[17] = {0x53, 0x56, 0x52, 0x33,
                               0xFF, 0xFF, 0xFF, 0xFF,
                               0xFF, 0xFF, 0xFF, 0xFF,
                               0xFF, 0xFF, 0xFF, 0xFF, 0x00}; // SunshineMario.arc
// ^ in ASCII the first 4 characters would be SVR3 (Service, Revision, Server, idk to be honest)
// BMD/BDL UNKNOWN 1 displays the same for big/little endian models (kinda like padding)

// sections
char * J3DGRAPH_BMD_SEC_START[9][2] = {{"INF1", "1FNI"},
                                       {"VTX1", "1XTV"},
                                       {"EVP1", "1PVE"},
                                       {"DRW1", "1WRD"},
                                       {"JNT1", "1TNJ"},
                                       {"SHP1", "1PHS"},
                                       {"MAT3", "3TAM"},
                                       {"TEX1", "1XET"},
                                       {NULL, NULL}}; // dirty trick (BDL/TEX1.c)

// include the different BMD section headers
#include "INF1.h"
#include "VTX1.h"
#include "EVP1.h"
#include "DRW1.h"
#include "JNT1.h"
#include "SHP1.h"
#include "MAT3.h"
#include "TEX1.h"

// function to check a BMD
j3dgraph_t check_j3dgraph_bmd(char * fpath);

// build/close/print a complete j3dgraph BMD structure
j3dgraph * open_j3dgraph_bmd(char * fpath);
void close_j3dgraph_bmd(j3dgraph * file);
void print_j3dgraph_bmd(j3dgraph * file);

#include "BMD.c"

#endif // BMD_BDL_HEADER
